package com.honhattan.ejb;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import com.honhattan.entity.Book;

@Stateless
public class BookManagement {
	
	@PersistenceContext
	private EntityManager em;
	
	public List<Book> getBooks(){
		return em.createNamedQuery("getAllBooks").getResultList();
	}
	
	public void saveBook(Book book){
		em.persist(book);
	}
}
